<!-- 审批端 -->
<template>
	<view class="">
		<view class="u-page">
			<!-- 审批 -->
			<!-- <audit :dataList="dataBase" v-show="current == 1"></audit> -->
			<!-- 我的 -->
			<user v-show="current == 3"></user>
			<!-- 0审查 1审批-->
			<list :current="current == 0?1:0" :datalist="list1"  v-show="current == 0 || current == 1"></list>
			<!-- 申请 -->
			<list2 :list="list2"  v-show="current == 2"></list2>
		</view>
		<u-tabbar v-model="current" :list="list"></u-tabbar>
	</view>
</template>

<script>
	import audit from '../audit/index'
	import home from '../index/index'
	import list from './list.vue'
	import list2 from './list2.vue'
	import user from '../userSide/user.vue'
	export default {
		components:{audit,home,list,list2,user},
		data() {
			return {
				list: [
					
					{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '审批',
						customIcon: false,
					},
					{
						iconPath: "bookmark",
						selectedIconPath: "bookmark-fill",
						text: '审查',
						// isDot: true,
						customIcon: false,
					},{
						iconPath: "coupon",
						selectedIconPath: "coupon-fill",
						text: '申请',
						customIcon: false,
					},
					
					{
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '我的',
						isDot: false,
						customIcon: false,
					},
				],
				list2:[],
				list1:[],
				dataBase:[],
				current: 0,
				info:{}
			}
		},
		watch:{
			current(e){
				let title = '审查'
				if(e==0){
					title= '审批'
				}else if(e==1){
					title= '审查'
				}else if(e==2){
					title= '申请'
				}else if(e==3){
					title= '我的'
				}
				uni.setNavigationBarTitle({
					title:title
				});
			}
		},
		onLoad() {
			// 获取申请列表
			let data = {
				type:'audit'
			}
			this.$api.list2({data:data}).then(res => {
				this.list2 = res.data
			}).catch(res => {})
			
			this.info = this.$db.get('info')
			// 审批列表
			// this.$api.currentList({academy:'轻工与食品工程学院'}).then(res => {
			// 	this.dataBase = res.data
			// }).cache(res => {})
			
			// 获取校门列表
			// let ar = {universityName:'广西科技大学',doorName:'东门'}
			// this.$api.university({data:ar}).then(res => {
			// 	this.dataBase = res.data
			// }).cache(res => {})
			
			// 门卫值班
			// let arr = {doorId:4,type:1}
			// this.$api.universityDuty({data:arr}).then(res => {
			// 	// this.dataBase = res.data
			// }).cache(res => {})
			
			// 门卫操作
			// this.$api.operation().then(res => {
			// 	// this.dataBase = res.data
			// }).cache(res => {})
			
			// 门口扫码
			// 0进1出
			// let arr = {doorId:4,type:1}
			// this.$api.scanQRCode({data:arr}).then(res => {
			// }).cache(res => {})
			
		},
		methods:{
			// 审批列表
			// currentList(){
			// 	this.$api.currentList({academy:''}).then(res => {
			// 		this.dataBase = res.data
			// 	}).cache(res => {})
			// }
			
		}
		
	}
</script>

<style lang="scss">
	.home-main {
		position: relative;
		margin-top: 20rpx;
		border-radius:  12rpx;
		background-color: white;
		padding: 68rpx 42rpx 42rpx;
	}
	.home-logo {
		width: 160rpx;
		height: 160rpx;
		border-radius: 50%;
		position: absolute;
		right: 50%;
		top: -80rpx;
		margin-right: -80rpx;
		border: 2rpx solid #fff;
	}
	.home-main-top {
		border-bottom: 2rpx solid #979797;
		.home-main-top-name {
			margin-bottom: 30rpx;
			text {
				color: #4D7CFB;
				font-size: 34rpx;
				margin-right: 20rpx;
			}
			view {
				color: #3B3B3B;
				font-size: 28rpx;
				
			}
		}
		
		
	}
	.home-main-top-type {
		margin-top: 30rpx;
		text {
			color: #797B87;
			font-size: 28rpx;
			margin-right: 20rpx;
		}
		view {
			color: #3B3B3B;
			
		}
	}
</style>
